@extends('admin.layout.layout')
@section('title','分类添加')
@section('con')
<div id="page-wrapper">
    <!-- 标题 -->
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">分类添加</h1>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                	请输入分类信息
                </div>
				<div class="panel-body">
                    <div class="row">
                    	<!-- 添加用户表单 -->
					    <div class="col-lg-6 col-lg-offset-2">
						    <form role="form" action="{{url('/admin/cate/insert')}}" method="post" enctype="multipart/form-data">
						        <div class="form-group">
					                <label>请选择父类</label>
					                <select class="form-control" name="pid">
					                    <option value="0">根类</option>
					                    @foreach($cates as $k=>$v)
					                    	<option value="{{$v->cid}}">{{$v->cname}}</option>
					                    @endforeach
					                </select>
					            </div>
						        <div class="form-group">
						            <label>类名:</label>
						            <input placeholder="请输入类名" class="form-control" name="cname" type="text">
						        </div>
						        <div class="form-group">
						            <label>子类图片:</label>
						            <input name="cpic" type="file">
						        </div>
						       	{{csrf_field()}}
						        <button class="btn btn-outline btn-primary" type="submit">提交</button>
						        <button class="btn btn-outline btn-danger" type="reset">重置</button>
						    </form>
					    </div>
					    <!-- 错误信息 -->
						<div style="height:100%" class="col-lg-4">
							@if (count($errors) > 0)
							   <div class="alert alert-danger alert-dismissable">
						            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
						            <ul>
							            @foreach ($errors->all() as $error)
							                <li>{{ $error }}</li>
							            @endforeach
							        </ul>
						        </div> 
							@endif
					    </div>
					</div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection